
package com.wyzz.hr.base;

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.*;

import com.wyzz.hr.bo.IBaseBo;
import com.wyzz.hr.spring.SpringBeanFactory;

public class AutoNo extends HttpServlet {

	public AutoNo() {
	}

	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		doGet(req, resp);
	}

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		String textfieldName = request.getParameter("textfieldName");
		String model = request.getParameter("model");
		String domainName = request.getParameter("domainName");
		if (model == null || domainName == null || textfieldName == null
				|| domainName.trim().length() == 0
				|| textfieldName.trim().length() == 0)
			return;
		if (textfieldName.indexOf(".") > 0)
			textfieldName = textfieldName
					.substring(textfieldName.indexOf(".") + 1);
		IBaseBo bo = (IBaseBo) SpringBeanFactory.getBean("baseService");
		String valu = bo.getNoByPrefix(domainName, textfieldName, model.trim());
		response.getWriter().write(valu);
	}

	private static final long serialVersionUID = 1L;
}
